package com.tpv.app.aidldemo;

import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.os.RemoteException;

public class RemoteService extends Service
{
    private MyBinder mBinder;
    public RemoteService()
    {
    
    }
    
    @Override
    public void onCreate()
    {
        super.onCreate();
        if (null==mBinder)
        {
            mBinder=new MyBinder();
        }
    }
    
    @Override
    public IBinder onBind(Intent intent)
    {
        return mBinder;
    }
    class MyBinder extends IRemoteInterface.Stub
    {
    
        @Override
        public void basicTypes(int anInt, long aLong, boolean aBoolean, float aFloat, double aDouble, String aString) throws RemoteException
        {
        }
    
        @Override
        public String callRemote() throws RemoteException
        {
            return "成功调用远程服务";
        }
    
        @Override
        public int add(int a, int b) throws RemoteException
        {
            return a+b;
        }
    }
}
